from sqlalchemy import Column, Integer, DECIMAL, UniqueConstraint
from .Base import (Base)

class Score(Base):
    __tablename__ = "score"

    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    student_id = Column(Integer, nullable=False, index=True)
    course_id = Column(Integer, nullable=False, index=True)
    exam_id = Column(Integer, nullable=False, index=True)
    score = Column(DECIMAL(5, 2), nullable=False)

    __table_args__ = (
        UniqueConstraint("student_id", "course_id", "exam_id", name="uniq_score"),
    )
